package org.ljf.stateEnum;

/**
 * @创建人 lIUJF
 * @创建时间 2018/12/20
 * @描述:
 */
public enum SecKillStateEnum {
	SUCCESS(1, "秒杀成功"), END(0, "秒杀结束"), REPEAT_KILL(-1, "重复秒杀"), INNER_ERROR(-2, "系统异常"), DATA_REWRITE(-3, "数据篡改");


	private int state;
	private String stateInfo;

	public int getState(){
		return state;
	}

	public String getStateInfo(){
		return stateInfo;
	}

	SecKillStateEnum(int state, String stateInfo){
		this.state = state;
		this.stateInfo = stateInfo;
	}

	public static SecKillStateEnum stateOf(int index){
		for (SecKillStateEnum state : values()) {
			if (state.getState() == index) {
				return state;
			}
		}
		return null;
	}
}
